package com.example.project.controller;

import com.example.project.model.bo.LotteryQueryDataVo;
import com.example.project.model.bo.PagingParam;
import com.example.project.service.LotteryExtBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * 控制器 博客出处：http://www.cnblogs.com/GoodHelper/
 *首页
 */
@Controller
public class IndexController {

    @Autowired
    LotteryExtBusinessService lotteryExtBusinessService;

    @RequestMapping(value = { "/index"}, method ={ RequestMethod.GET, RequestMethod.POST})
    public String index(PagingParam pagingParam, Model model) {
        LotteryQueryDataVo lotteryQueryDataVo = lotteryExtBusinessService.loadLotteryList(pagingParam);
        model.addAttribute("data",lotteryQueryDataVo);
        model.addAttribute("pagingParam",pagingParam);
        return "default";
    }


    @RequestMapping(value = { "/"}, method ={ RequestMethod.GET, RequestMethod.POST})
    public String root(PagingParam pagingParam, Model model) {
        LotteryQueryDataVo lotteryQueryDataVo = lotteryExtBusinessService.loadLotteryList(pagingParam);
        model.addAttribute("data",lotteryQueryDataVo);
        model.addAttribute("pagingParam",pagingParam);
        return "default";
    }

}